package com.xilixili.miaomi.wechat.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by liumin on 2017/12/19.
 */

public class TweetInfo {
    String content = "";
    List<ImageInfo> images = new ArrayList<>();
    UserInfo sender = new UserInfo();
    List<ContentInfo> comments = new ArrayList<>();

    public boolean checkValid(){

        boolean ret = false;
        if(images == null) {
            ret = false;
        } else {
            for(ImageInfo info : images) {
                ret = ret || info.checkValid();
            }
        }

        if(content == null && !ret){
            return false;
        }

        if(!sender.checkValid()) {
            return false;
        }

        return true;
    }

    public String getContent() {
        return content;
    }

    public List<ImageInfo> getImages() {
        return images;
    }

    public UserInfo getSender() {
        return sender;
    }

    public List<ContentInfo> getComments() {
        return comments;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public void setImages(List<ImageInfo> images) {
        this.images = images;
    }

    public void setSender(UserInfo sender) {
        this.sender = sender;
    }

    public void setComments(List<ContentInfo> comments) {
        this.comments = comments;
    }

    @Override
    public String toString() {
        return "TweetInfo{" +
                "content='" + content  + '\'' +
                ", images='" + images.toString() + '\'' +
                ", sender='" + sender.toString() + '\'' +
                ", comments='" + comments.toString() + '\'' +
                '}';
    }

    @Override
    public TweetInfo clone() throws CloneNotSupportedException {
        TweetInfo info = new TweetInfo();
        info.setContent(getContent());
        info.setImages(getImages());
        info.setSender(getSender());
        info.setComments(getComments());

        return info;
    }
}
